using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class OEPhysicianMap : EntityTypeConfiguration<OEPhysician>
    {
        public OEPhysicianMap()
        {
            // Primary Key
            this.HasKey(t => new { t.mode, t.symbol });

            // Properties
            this.Property(t => t.number)
                .HasMaxLength(8);

            this.Property(t => t.item_srh)
                .HasMaxLength(10);

            this.Property(t => t.Type)
                .HasMaxLength(25);

            this.Property(t => t.company)
                .HasMaxLength(33);

            this.Property(t => t.address)
                .HasMaxLength(33);

            this.Property(t => t.Phone)
                .HasMaxLength(12);

            this.Property(t => t.Fax)
                .HasMaxLength(12);

            this.Property(t => t.mode)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.G1)
                .HasMaxLength(110);

            this.Property(t => t.G2)
                .HasMaxLength(110);

            this.Property(t => t.item)
                .HasMaxLength(10);

            this.Property(t => t.pat)
                .HasMaxLength(110);

            this.Property(t => t.desc)
                .HasMaxLength(250);

            this.Property(t => t.symbol)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.addressPat)
                .HasMaxLength(200);

            this.Property(t => t.city)
                .HasMaxLength(30);

            this.Property(t => t.vcompany)
                .HasMaxLength(35);

            // Table & Column Mappings
            this.ToTable("OEPhysicians");
            this.Property(t => t.number).HasColumnName("number");
            this.Property(t => t.OPERATIONSERIAL).HasColumnName("OPERATIONSERIAL");
            this.Property(t => t.item_srh).HasColumnName("item_srh");
            this.Property(t => t.criteria).HasColumnName("criteria");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Type_id).HasColumnName("Type_id");
            this.Property(t => t.company).HasColumnName("company");
            this.Property(t => t.address).HasColumnName("address");
            this.Property(t => t.Phone).HasColumnName("Phone");
            this.Property(t => t.Fax).HasColumnName("Fax");
            this.Property(t => t.mode).HasColumnName("mode");
            this.Property(t => t.date).HasColumnName("date");
            this.Property(t => t.entry_date).HasColumnName("entry_date");
            this.Property(t => t.G1).HasColumnName("G1");
            this.Property(t => t.G2).HasColumnName("G2");
            this.Property(t => t.item).HasColumnName("item");
            this.Property(t => t.pat).HasColumnName("pat");
            this.Property(t => t.desc).HasColumnName("desc");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.symbol).HasColumnName("symbol");
            this.Property(t => t.patamtact).HasColumnName("patamtact");
            this.Property(t => t.patient_amount).HasColumnName("patient amount");
            this.Property(t => t.ins1amtact).HasColumnName("ins1amtact");
            this.Property(t => t.ins2amtact).HasColumnName("ins2amtact");
            this.Property(t => t.DiscountA).HasColumnName("DiscountA");
            this.Property(t => t.qtyship).HasColumnName("qtyship");
            this.Property(t => t.ins1perc).HasColumnName("ins1perc");
            this.Property(t => t.ins2perc).HasColumnName("ins2perc");
            this.Property(t => t.patient_prercentage).HasColumnName("patient prercentage");
            this.Property(t => t.G1pAmount).HasColumnName("G1pAmount");
            this.Property(t => t.G2pAmount).HasColumnName("G2pAmount");
            this.Property(t => t.addressPat).HasColumnName("addressPat");
            this.Property(t => t.city).HasColumnName("city");
            this.Property(t => t.MedicalAmount).HasColumnName("MedicalAmount");
            this.Property(t => t.vcompany).HasColumnName("vcompany");
            this.Property(t => t.G1amount).HasColumnName("G1amount");
            this.Property(t => t.G2Amount).HasColumnName("G2Amount");
            this.Property(t => t.AdmisionDate).HasColumnName("AdmisionDate");
            this.Property(t => t.DischargeDate).HasColumnName("DischargeDate");
            this.Property(t => t.patamount).HasColumnName("patamount");
            this.Property(t => t.Total).HasColumnName("Total");
            this.Property(t => t.Price).HasColumnName("Price");
        }
    }
}
